<?php
require_once("lib/auth/session.php");
require_once("lib/sqlConnector.php");
require_once("lib/auth/user.php");


// gets single comment by ID
function getComment($commentid) {
	$result = sqlQuery("SELECT * FROM comments WHERE commentid = '%s'",$commentid);
	return mysql_fetch_assoc($result);
}

// gets all comments for specific post ID
function getCommentsForPost($postid) {
	$result = sqlQuery("SELECT * FROM comments WHERE postid = '%s'",$postid);//comments aren't sorted
	$arr = Array();
    while($temp = mysql_fetch_assoc($result)) {
    	$temp['name'] = id2Name($temp['userid']);
    	$arr[] = $temp;
    }
    return $arr;
}
?>